#coding=utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

import bottle
import config
#默认端口  run(host='localhost', port=8080)

app = bottle.default_app()
app.config.update(config.default())

from bottle import run
import web

# route = Route(app, rule, method, callback,
#                  name=None,
#                  plugins=None,
#                  skiplist=None, **config)
# self.add_route(route)

if __name__=='__main__':
	#run(app, service='cgi', reloader=True, debug=True, port=7777, host='0.0.0.0')

	import tornado.wsgi, tornado.httpserver, tornado.ioloop
	container = tornado.wsgi.WSGIContainer(app)
	sockets=tornado.netutil.bind_sockets(7777)
	tornado.process.fork_processes(4)
	http_server = tornado.httpserver.HTTPServer(container)
	http_server.add_sockets(sockets)
	tornado.ioloop.IOLoop.instance().start()
